﻿@using CodeWF.Utils
@inject IJSRuntime jsRunTime

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <base href="/"/>
    <link href="_content/Masa.Blazor/css/masa-blazor.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/app.css"/>
    <link rel="stylesheet" href="css/ssr.css"/>
    <link rel="stylesheet" href="CodeWF.Tools.Web.styles.css"/>
    <link href="https://cdn.masastack.com/npm/@("@mdi")/font@7.1.96/css/materialdesignicons.min.css" rel="stylesheet">
    <link rel="icon" type="image/png" href="logo.png"/>
    <HeadOutlet/>
    <MSsrThemeProvider/>
    <script>
        window.getDomain = function () {
            return window.location.host;
        };
    </script>

    @code {
        private string currentDomain = string.Empty;

        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            currentDomain = await jsRunTime.InvokeAsync<string>("getDomain");
            await base.OnAfterRenderAsync(firstRender);
        }

    }

    <environment include="Production">
        @if (currentDomain.EndsWith(DomainType.Dotnet9Com.Description()))
        {
            <script>
                var _hmt = _hmt || [];
                (function () {
                    var hm = document.createElement("script");
                    hm.src = "https://hm.baidu.com/hm.js?b1c5c62f256893710ae912468261bf6b";
                    var s = document.getElementsByTagName("script")[0];
                    s.parentNode.insertBefore(hm, s);
                })();
            </script>
        }
        else if (currentDomain.EndsWith(DomainType.DotnetToolsCom.Description()))
        {
            <script>
                var _hmt = _hmt || [];
                (function () {
                    var hm = document.createElement("script");
                    hm.src = "https://hm.baidu.com/hm.js?96b0fbecf9bc9efb7e5d7be8345dcb38";
                    var s = document.getElementsByTagName("script")[0];
                    s.parentNode.insertBefore(hm, s);
                })();
            </script>
        }
        else if (currentDomain.EndsWith(DomainType.CodeWFCom.Description()))
        {
            <script>
                var _hmt = _hmt || [];
                (function () {
                    var hm = document.createElement("script");
                    hm.src = "https://hm.baidu.com/hm.js?4cdd01eed538a43a4ce5afca09af222e";
                    var s = document.getElementsByTagName("script")[0];
                    s.parentNode.insertBefore(hm, s);
                })();
            </script>
        }
        else
        {
            <script>
                var _hmt = _hmt || [];
                (function () {
                    var hm = document.createElement("script");
                    hm.src = "https://hm.baidu.com/hm.js?dea4adc26987eabf06159a32b674efd0";
                    var s = document.getElementsByTagName("script")[0];
                    s.parentNode.insertBefore(hm, s);
                })();
            </script>
        }

        <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8748951917303002"
                crossorigin="anonymous"></script>
    </environment>
</head>

<body>
<Routes/>
<script src="_framework/blazor.web.js"></script>
<script src="_content/BlazorComponent/js/blazor-component.js"></script>
<script type="text/javascript">
        window.clipboardCopy = {
            copyText: function (text) {
                navigator.clipboard.writeText(text).then(function () {
                    
                })
                    .catch(function (error) {
                        alert(error);
                    });
            }
        };
    </script>
</body>

</html>